


#ifndef __U_PID__H
#define __U_PID__H

#include "user_type.h"


typedef struct 
{
  /* data */

  float A0;
  float A1;
  float A2;

  float state[3];

  float Kp;
  float Ki;
  float Kd;
	
	int32_t max;
	int32_t min;

}u_pidType;



void pid_init(u_pidType *s, uint8_t resetStateFlag,float KP,float KI,float KD,int32_t pwmMax,int32_t pwmMin);
void pid_reset(u_pidType *s);
int32_t pid(u_pidType *s,int32_t pid_err);











#endif

